//
//  CZNetWorkTools.m
//  packDemo
//
//  Created by apple on 16/6/18.
//  Copyright © 2016年 itcast. All rights reserved.
//

#import "CZNetWorkTools.h"
#import <AFNetworking.h>
@implementation CZNetWorkTools
+(instancetype)shareNetWorkTools{
    static CZNetWorkTools *tools;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        tools = [[CZNetWorkTools alloc]init];
        tools.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html", nil];
    });
    return tools;
}

-(void)objectListWithUrlString:(NSString *)url andParameters:(NSDictionary *)param andFinishBlock:(FinishedBlock)finishBlock{
    [self GET:url parameters:param progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        if (finishBlock) {
            finishBlock(responseObject);
        }
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"%@",error);
    }];



}




@end
